package cn.fengzhilun.javase.day12;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;

import org.junit.Test;

public class TestAllClass {
	@Test
	public void test1() {
		String s="abc";
		for(int i=0;i<s.length();i++) {
			System.out.println(s.charAt(i));
			
		}
		
		String s2= "to be or not to be";
		String[] split = s2.split(" ");
		
		for(int i=0;i<split.length;i++) {
			System.out.println(split[i]);
		}
		
		System.out.println(String .format("生存还是死亡这是%d问题", 1));
		System.out.printf("生存还是死亡这是%d问题", 1);
	}
	@Test
	public void test2() {
		//StringBuilder sb =new StringBuilder();
		HashSet<String> hs=new HashSet();
		String s2= "to be or not to be";
		String[] split = s2.split(" ");
		
		for(int i=0;i<split.length;i++) {
			//System.out.println(split[i]);
			hs.add(split[i]);
		}
//		for(String i:hs) {
//			System.out.println(i);
//		}
		
		//for()
		//System.out.println(hs);
		Iterator<String> iterator = hs.iterator();
		while(iterator.hasNext()) {
			System.out.println(iterator.next());
		}
	}
}
